window.addEventListener('pageshow', function(event) {
	if(localStorage.onloadState == 'true') {
		localStorage.onloadState = false;
		window.location.reload();
	}
});
var main = new Vue({
	el: '#main',
	data: {
		idCard: JSON.parse(localStorage.user_info || '{}').sbkh,
		adress: JSON.parse(localStorage.user_info || '{}').address,
		csrq: "",
		xb: JSON.parse(localStorage.user_info || '{}').gender,
		mobilePhone: JSON.parse(localStorage.user_info || '{}').phone,
		xm: JSON.parse(localStorage.user_info || '{}').name,
		lxr: JSON.parse(localStorage.user_info || '{}').lxr,
		lxrlxdh: JSON.parse(localStorage.user_info || '{}').lxrlxdh,
		zjhm: "",
		yizhi: false,
		institutions: localStorage.hospitalName || '',
		institutionsid: localStorage.hospitalNameID || '',
		user: JSON.parse(localStorage.user_info || '{}'),
		workerIcon: JSON.parse(localStorage.user_info || "{}").headIcon || "", //头像
		workerGender: JSON.parse(localStorage.user_info || "{}").gender, //性别
		imgIp: localStorage.ip,
	},
	methods: {
		yuedu: function() {
			this.yizhi = !this.yizhi
		},
		tijiao: function() {
			if(this.institutions.length < 2) {
				log_message("请选择医院机构")
			} else if(this.yizhi) {
				qingqiu()
			} else {
				log_message("请勾选申请须知")
			}
		}
	}
});

//$.ajax({
//	type:'POST',
//	url:'http://221.0.79.248:8083/jkcsHt/getUserInfo.service',
//	data:"",
//	success:function(result){
//		main.adress=result.address;
//		main.csrq=result.birthday;
//		main.xb=result.gender;
//		main.mobilePhone=result.phoneNum;
//		main.xm=result.name;
//		main.zjhm=result.patientCardId;
//	}
//})

//			var obj={
//			    "birthday": "1944-02-04",
//			    "address": "",
//			    "patientCardType": "1",
//			    "gender": "2",
//			    "avatarUrl": "5a4ddcfd2ba23218685b6add",
//			    "patientCardId": "370602194402042922",
//			    "kinship": "0",
//			    "weight": "",
//			    "phoneNum": "13853508838",
//			    "isDefault": "0",
//			    "USERID": "81963f24-88a2-4f6e-a8f3-b715b90dd29c",
//			    "name": "王玉英",
//			    "ROLEID": "123",
//			    "age": "",
//			    "height": ""
//			}
function qingqiu() {
	ajaxPostJson(
		Url.PGAPPLY_PGAPPLY, {
			"sbkh": main.idCard,
			"address": main.adress,
			"csrq": main.csrq,
			"xb": main.xb,
			"mobilePhone": main.mobilePhone,
			"xm": main.xm,
			"zjhm": main.zjhm,
			"fwyxjg": main.institutions,
			"fwyxjgId": main.institutionsid,
			"user": main.user,
			"lxrlxdh": main.lxrlxdh,
			"lxr": main.lxr
		},
		function(data) {
			log_message(data.message)
			if(data.status == 1) {
				localStorage.user_info = JSON.stringify(data.response)
				setTimeout("window.history.go(-1)", 1000)
			}
		}
	)
};
document.getElementById("main").setAttribute("style", "display: block;min-height: 49rem;");